<?
   require_once('config.php');
   $per_name = getValue('per_name','str','POST','');
   $vid_id   = getValue('vid','int','POST',0);  
   $per_name = trim($per_name);
   if($per_name != ''){
      $sql_insert = "INSERT IGNORE INTO
                        person(per_name)
                     VALUES('" . $per_name . "')";
      $db_exe = new db_execute($sql_insert);
      $rows_inserted = $db_exe->rows_affected;
      $last_id    = $db_exe->last_id;
      unset($db_exe);
      if($last_id > 0){
         $db_exe = new db_execute("INSERT IGNORE INTO 
                                             vid_per(vid_id,per_id)
                                             VALUES(" . $vid_id . "," . $last_id . ")");
      }
      if($rows_inserted >= 1){
         echo 'Đã thêm';
      }else{
         echo 'Trùng tên';
      }
   }        
?>